/*
 * @Date: 2020-10-05 20:07:54
 * @Author: David
 * @LastEditors: OBKoro1
 * @LastEditTime: 2020-10-06 21:29:01
 * @FilePath: /huanyong-task-01-01/code/demo1.js
 * @Description: 代码题
 */
/**
 * 一、使用 promise 改进
 * 使用 then 回调传递参数
 */

new Promise(resolve => {
    var a = 'hello'
    setTimeout(() => {
        resolve(a)
    }, 10);
}).then(data => {
    // 返回一个 promise 对象
    return new Promise(resolve => {
        var b = 'lagou'
        setTimeout(() => {
            resolve(data + b)
        }, 10);
    })
}).then(data => {
    var c = 'I 💙 U'
    setTimeout(() => {
        // 最后输出 hellolagouI 💙 U
        console.log('最终组合输出结果:',data + c);
    }, 10);
})



